<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../common/admin.asp"-->
<%
if request.QueryString("inquiryID")<>"" then
  inquiryID=request.QueryString("inquiryID")
  inquiry_pic=request.QueryString("inquiry_pic")
  inquiry_title=request.QueryString("inquiry_title")
end if


id=request.QueryString("id")
if id<>"" then
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from product where pid="&id&""
	rs.open sql,conn,1,3
	if not rs.eof then
	     title=rs("title")
		 jptitle=rs("jptitle")
		 sort=rs("sort")
		 typeid=rs("type")
		 bid=rs("bid")
		 weight=rs("weight")
		 color=rs("color")
		 size=rs("size")
		 RelationID=rs("RelationID")
		 pic=rs("pic")
		 mark=rs("mark")
		 key=rs("key")
		 desc=rs("desc")
		 Simple=rs("Simple")
		 content=rs("content")
		 inventory=rs("inventory")
	rs.close
	set rs=nothing
	end if
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>add</title>
<link href="../css/style.css" rel="stylesheet" type="text/css"/>
<style>body {background-color: #eaece1;}</style>
<script language="javascript" type="text/javascript" src="../js/bd.js"></script>




<script charset="utf-8" src="../kindeditor/kindeditor.js"></script>
	<script charset="utf-8" src="../kindeditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="../kindeditor/plugins/code/prettify.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content"]', {
				cssPath : '../kindeditor/plugins/code/prettify.css',
				uploadJson : '../kindeditor/asp/upload_json.asp',
				fileManagerJson : '../kindeditor/asp/file_manager_json.asp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>



<script>
    function checkMain(id) {
        len = document.theForm.elements.length;
        var mainchecked = document.all("m" + id).checked;
        var i = 0;
        for (i = 0; i < len; i++) {
            if (document.theForm.elements[i].id == 's' + id) {
                document.theForm.elements[i].checked = mainchecked;
            }
        }
    };
 
    function checkSub(id) {
        len = document.theForm.elements.length;
        var i = 0;
        for (i = 0; i < len; i++) {
            if (document.theForm.elements[i].id == 's' + id) {
                if (document.theForm.elements[i].checked) {
                    document.all("m" + id).checked = true;
                    return;
                }
            }
        }
        document.all("m" + id).checked = false;
    };
</script>

</head>

<body>

  
  
  <%if id<>"" then%>
  
  <div class="main">
  <div class="main-title">操作</div>
  <div class="main-content">
  <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tab">
  <form name="theForm" id="demo" method="post" onSubmit="return Validator.Validate(this,3)">
  <tr>
    <td width="9%" bgcolor="#FFFFFF">中文标题</td>
    <td width="91%" bgcolor="#FFFFFF"><input name="title" type="text" class="input" id="title" value="<%=title%>" dataType="LimitB" min="1" max="50" msg="标题[1,50]字符以内" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">日文标题</td>
    <td bgcolor="#FFFFFF"><input name="jptitle" type="text" class="input" id="jptitle" value="<%=jptitle%>" datatype="LimitB" min="1" max="50" msg="标题[1,50]字符以内" /></td>
  </tr>
  <tr style="display:none">
    <td bgcolor="#FFFFFF">排序</td>
    <td bgcolor="#FFFFFF"><input name="sort" type="text" class="input" id="sort" value="<%=sort%>" style="width:40px" dataType="Number" min="1" max="5" msg="排序必须为数字"/>
    排序由小到大</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">类目</td>
    <td bgcolor="#FFFFFF"><select name="typeid" dataType="Require" msg="未选择所用商品类目">
    <%
		iic=0
		sub info_typelistc(selecc)
		set rsmtc=conn.execute("select * from protype where fid="&selecc&" order by sort desc")
		do while not rsmtc.eof
		if selecc=0 then
		%>
      <option value="<%=rsmtc("id")%>" <%if typeid=rsmtc("id") then response.write "selected"%>><%=rsmtc("title")%></option>
      <%
		else
		%>
      <option value="<%=rsmtc("id")%>" <%if typeid=rsmtc("id") then response.write "selected"%>><%=string(iic*2,"　")%><%=rsmtc("title")%></option>
       <%
		end if
		iic=iic+1
		   info_typelistc(rsmtc("id"))
		iic=iic-1
		rsmtc.movenext
		loop
		set rsmtc=nothing
		end sub
		info_typelistc(0)		
		%>
    </select></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">品牌</td>
    <td bgcolor="#FFFFFF"><select name="bid" id="bid">
                    <%		
					set rsnewx=server.CreateObject("adodb.recordset")
					sql="select id,title from brand order by id desc"
					rsnewx.open sql,conn,1,3
					if not rsnewx.eof then
					do while not rsnewx.eof 
					%>
					<option value="<%=rsnewx("id")%>" <%if bid=rsnewx("id") then response.write "selected"%>><%=rsnewx("title")%></option>
					<%
					rsnewx.movenext
					loop
					rsnewx.close
					set rsnewx=nothing
					end if		 
					%>
    </select></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">库存</td>
    <td bgcolor="#FFFFFF"><input name="inventory" type="text" class="input" id="inventory" style="width:40px" value="<%=inventory%>" dataType="Number" min="1" max="10" msg="重量只能输入数字" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">重量</td>
    <td bgcolor="#FFFFFF"><input name="Weight" type="text" class="input" id="Weight" style="width:40px" value="<%=Weight%>" dataType="Number" min="1" max="10" msg="重量只能输入数字" />
      克</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">颜色</td>
    <td bgcolor="#FFFFFF"><input name="color" type="text" class="input" id="color" value="<%=color%>" datatype="LimitB" min="1" max="50" msg="标题[1,50]字符以内" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">规格</td>
    <td bgcolor="#FFFFFF"><input name="size" type="text" class="input" id="size" value="<%=size%>" datatype="LimitB" min="1" max="50" msg="标题[1,50]字符以内" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">关联</td>
    <td bgcolor="#FFFFFF"><input name="RelationID" type="text" class="input" id="RelationID" value="<%=RelationID%>" datatype="LimitB" min="1" max="50" msg="标题[1,50]字符以内" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">图片</td>
    <td bgcolor="#FFFFFF"><input name="pic" type="text" class="input" value="<%=pic%>" dataType="Filter" msg="图片格式，支持jpg, gif, png" accept="jpg, gif, png" /><input type="button" name="Submit26" value="图片上传 " onClick="window.open('../inc/upload.asp?formname=theForm&editname=pic&amp;uppath=baby_sphoto&amp;filelx=jpg&amp;type=pic','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">状态</td>
    <td bgcolor="#FFFFFF"><input type="radio" name="mark" id="radio" value="0"<%if mark="0" then response.Write " checked"%> />
      商品下架 
        <input type="radio" name="mark" id="radio2" value="1"<%if mark="1" then response.Write " checked"%> />
        商品上架</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">关键字</td>
    <td bgcolor="#FFFFFF"><input name="key" type="text" class="input" id="key" value="<%=key%>" dataType="LimitB" min="1" max="500" msg="关键字[1,500]字符以内" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">关键字描述</td>
    <td bgcolor="#FFFFFF"><textarea name="desc" cols="40" rows="3" class="content-input" id="desc" dataType="LimitB" min="1" max="1000" msg="关键字描述[1,1000]字符以内"><%=desc%></textarea></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">简单描述</td>
    <td bgcolor="#FFFFFF"><textarea name="Simple" cols="40" rows="3" class="content-input" id="Simple" datatype="LimitB" min="1" max="1000" msg="关键字描述[1,1000]字符以内"><%=Simple%></textarea></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">详细描述</td>
    <td bgcolor="#FFFFFF"><textarea style="width:80%;height:300px;visibility:hidden;" name="content" id="content" dataType="LimitB" min="1" max="10000" msg="商品详情[1,10000]字符以内"><%=content%></textarea></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#FFFFFF">
    <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tab">
      <tr>
        <td colspan="7">商品购买来源</td>
        </tr>
      <tr>
        <td align="center" bgcolor="#FFFFFF">默认</td>
        <td bgcolor="#FFFFFF">店铺</td>
        <td bgcolor="#FFFFFF">链接</td>
        <td bgcolor="#FFFFFF">价格（日元）</td>
        <td bgcolor="#FFFFFF">运费（日元）</td>
        <td bgcolor="#FFFFFF">限购数量</td>
        <td bgcolor="#FFFFFF">预计到货时间</td>
        </tr>
        
        
                    <%		
					set rst=server.CreateObject("adodb.recordset")
					sql="select * from Source where pid="&id&""
					rst.open sql,conn,1,3
					if not rst.eof then
					do while not rst.eof 
					%>
      <tr>
        <td align="center" bgcolor="#FFFFFF"><input name="radio" type="radio" id="radio3" value="<%=rst("id")%>"<%if rst("istop")="1" then response.Write " checked"%> /></td>
        <td bgcolor="#FFFFFF">
        <select name="sid<%=rst("id")%>" size="5">
        <option disabled>实体店</option>
                    <%		
					set rsnewx=server.CreateObject("adodb.recordset")
					sql="select sid,title from shop where typeid=0"
					rsnewx.open sql,conn,1,3
					if not rsnewx.eof then
					do while not rsnewx.eof 
					%>
					<option value="<%=rsnewx("sid")%>" <%if rst("sid")=rsnewx("sid") then response.write "selected"%>>　<%=rsnewx("title")%></option>
					<%
					rsnewx.movenext
					loop
					rsnewx.close
					set rsnewx=nothing
					end if		 
					%>
         <option disabled>购物网</option> 
                    <%		
					set rsnewx=server.CreateObject("adodb.recordset")
					sql="select sid,title from shop where typeid=1 "
					rsnewx.open sql,conn,1,3
					if not rsnewx.eof then
					do while not rsnewx.eof 
					%>
					<option value="<%=rsnewx("sid")%>" <%if rst("sid")=rsnewx("sid") then response.write "selected"%>>　<%=rsnewx("title")%></option>
					<%
					rsnewx.movenext
					loop
					rsnewx.close
					set rsnewx=nothing
					end if		 
					%>
        </select>
        </td>
        <td bgcolor="#FFFFFF"><textarea name="url<%=rst("id")%>" rows="3" class="content-input" id="url<%=rst("id")%>" datatype="LimitB" min="1" max="1000" msg="关键字描述[1,1000]字符以内"><%=rst("url")%></textarea></td>
        <td bgcolor="#FFFFFF"><input name="price<%=rst("id")%>" type="text" class="input" id="price<%=rst("id")%>" style="width:40px" value="<%=rst("price")%>" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="transCost<%=rst("id")%>" type="text" class="input" id="transCost<%=rst("id")%>" style="width:40px" value="<%=rst("transCost")%>" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="Limited<%=rst("id")%>" type="text" class="input" id="Limited<%=rst("id")%>" style="width:40px" value="<%=rst("Limited")%>" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="Arrivaltime<%=rst("id")%>" type="text" class="input" id="Arrivaltime<%=rst("id")%>" style="width:40px" value="<%=rst("Arrivaltime")%>" datatype="Number" min="1" max="5" msg="排序必须为数字"/>
          <input name="Eid" type="hidden" id="Eid" value="<%=rst("id")%>" />
          <a href="?id=<%=id%>&Did=<%=rst("id")%>">删除</a></td>
        </tr>
                    <%
					rst.movenext
					loop
					rst.close
					set rst=nothing
					end if		 
					%>
        
        
        
        
    </table>
    </td>
    </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><input type="submit" name="button" id="button" value="<%if request.QueryString("copy")="yes" then response.Write "保存为新商品" else response.Write "保存"%>" />
      </td>
  </tr>
  </form>
  
  <form name="theFormx" id="demo" method="post" onSubmit="return Validator.Validate(this,3)">
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
  <tr>
    <td colspan="2" bgcolor="#FFFFFF">
    <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tab">
      <tr>
        <td colspan="6">增加</td>
        </tr>
      <tr>
        <td bgcolor="#FFFFFF">店铺</td>
        <td bgcolor="#FFFFFF">链接</td>
        <td bgcolor="#FFFFFF">价格（日元）</td>
        <td bgcolor="#FFFFFF">运费（日元）</td>
        <td bgcolor="#FFFFFF">限购数量</td>
        <td bgcolor="#FFFFFF">预计到货时间</td>
        </tr>
        
        
      <%for i=1 to 5%>  
      <tr>
        <td bgcolor="#FFFFFF">
          <select name="sid<%=i%>" size="5">
            <option disabled>实体店</option>
            <%		
					set rsnewx=server.CreateObject("adodb.recordset")
					sql="select sid,title from shop where typeid=0"
					rsnewx.open sql,conn,1,3
					if not rsnewx.eof then
					do while not rsnewx.eof 
					%>
            <option value="<%=rsnewx("sid")%>" <%if bid=rsnewx("sid") then response.write "selected"%>>　<%=rsnewx("title")%></option>
            <%
					rsnewx.movenext
					loop
					rsnewx.close
					set rsnewx=nothing
					end if		 
					%>
            <option disabled>购物网</option> 
            <%		
					set rsnewx=server.CreateObject("adodb.recordset")
					sql="select sid,title from shop where typeid=1 "
					rsnewx.open sql,conn,1,3
					if not rsnewx.eof then
					do while not rsnewx.eof 
					%>
            <option value="<%=rsnewx("sid")%>" <%if bid=rsnewx("sid") then response.write "selected"%>>　<%=rsnewx("title")%></option>
            <%
					rsnewx.movenext
					loop
					rsnewx.close
					set rsnewx=nothing
					end if		 
					%>
            </select>
        </td>
        <td bgcolor="#FFFFFF"><textarea name="url<%=i%>" rows="3" class="content-input" id="url<%=i%>" datatype="LimitB" min="1" max="1000" msg="关键字描述[1,1000]字符以内"></textarea></td>
        <td bgcolor="#FFFFFF"><input name="price<%=i%>" type="text" class="input" id="price<%=i%>" style="width:40px" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="transCost<%=i%>" type="text" class="input" id="transCost<%=i%>" style="width:40px" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="Limited<%=i%>" type="text" class="input" id="Limited<%=i%>" style="width:40px" value="0" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="Arrivaltime<%=i%>" type="text" class="input" id="Arrivaltime<%=i%>" style="width:40px" value="0" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        </tr>
       <%next%> 
        
        
        
        
    </table>
    </td>
    </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><input type="submit" name="button" id="button" value="来源添加" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"></td>
    </tr>
    </form>
  </table>
  </div>
</div>
  
  
  
  <%else%>
  <form name="theForm" id="demo" method="post" onSubmit="return Validator.Validate(this,3)">
  <div class="main">
  <div class="main-title">操作</div>
  <div class="main-content">
  <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tab">
  <tr>
    <td width="8%" bgcolor="#FFFFFF">中文标题</td>
    <td width="92%" bgcolor="#FFFFFF"><input name="title" type="text" class="input" id="title" value="<%=inquiry_title%>" dataType="LimitB" min="1" max="50" msg="标题[1,50]字符以内"/></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">日文标题</td>
    <td bgcolor="#FFFFFF"><input name="jptitle" type="text" class="input" id="jptitle" datatype="LimitB" min="1" max="50" msg="标题[1,50]字符以内"/></td>
  </tr>
  <tr style="display:none">
    <td bgcolor="#FFFFFF">排序</td>
    <td bgcolor="#FFFFFF"><input name="sort" type="text" class="input" id="sort" style="width:40px" value="0" dataType="Number" min="1" max="5" msg="排序必须为数字" />
      排序由小到大</td>
  </tr>
    <tr>
    <td bgcolor="#FFFFFF">类目</td>
    <td bgcolor="#FFFFFF"><select name="typeid" dataType="Require" msg="未选择所用商品类目">
    <option value="">商品类目</option>
	<%
		ii=0
		sub info_typelist(selec)
		set rsmt=conn.execute("select * from protype where fid="&selec&" order by sort desc")
		do while not rsmt.eof
		if selec=0 then
		%>
      <option value="<%=rsmt("id")%>"><%=rsmt("title")%></option>
      <%
		else
		%>
      <option value="<%=rsmt("id")%>"><%=string(ii*2,"　")%><%=rsmt("title")%></option>
       <%
		end if
		ii=ii+1
		   info_typelist(rsmt("id"))
		ii=ii-1
		rsmt.movenext
		loop
		set rsmt=nothing
		end sub
		info_typelist(0)		
		%>
    </select></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">品牌</td>
    <td bgcolor="#FFFFFF"><select name="bid" id="bid">
                    <%		
					set rsnewx=server.CreateObject("adodb.recordset")
					sql="select id,title from brand order by id desc"
					rsnewx.open sql,conn,1,3
					if not rsnewx.eof then
					do while not rsnewx.eof 
					%>
					<option value="<%=rsnewx("id")%>"><%=rsnewx("title")%></option>
					<%
					rsnewx.movenext
					loop
					rsnewx.close
					set rsnewx=nothing
					end if		 
					%>
    </select></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">库存</td>
    <td bgcolor="#FFFFFF"><input name="inventory" type="text" class="input" id="inventory" style="width:40px" value="0" dataType="Number" min="1" max="10" msg="重量只能输入数字" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">重量</td>
    <td bgcolor="#FFFFFF"><input name="Weight" type="text" class="input" id="Weight" style="width:40px" value="0" dataType="Number" min="1" max="10" msg="重量只能输入数字" />
      克</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">颜色</td>
    <td bgcolor="#FFFFFF"><input name="color" type="text" class="input" id="color" datatype="Number" min="1" max="10" msg="重量只能输入数字" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">规格</td>
    <td bgcolor="#FFFFFF"><input name="size" type="text" class="input" id="size" datatype="Number" min="1" max="10" msg="重量只能输入数字" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">关联</td>
    <td bgcolor="#FFFFFF"><input name="RelationID" type="text" class="input" id="RelationID" style="width:40px" datatype="Number" min="1" max="5" msg="排序必须为数字" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">图片</td>
    <td bgcolor="#FFFFFF"><input name="pic" type="text" class="input" id="pic" value="<%=inquiry_pic%>" dataType="Filter" msg="图片格式，支持jpg, gif, png" accept="jpg, gif, png" /><input type="button" name="Submit26" value="图片上传 " onClick="window.open('../inc/upload.asp?formname=theForm&editname=pic&amp;uppath=baby_sphoto&amp;filelx=jpg&amp;type=pic','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">状态</td>
    <td bgcolor="#FFFFFF"><input type="radio" name="mark" id="radio" value="0" />
      商品下架 
        <input name="mark" type="radio" id="radio2" value="1" checked="checked" />
        商品上架</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">关键字</td>
    <td bgcolor="#FFFFFF"><input name="key" type="text" class="input" id="key" dataType="LimitB" min="1" max="500" msg="关键字[1,500]字符以内" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">关键字描述</td>
    <td bgcolor="#FFFFFF"><textarea name="desc" cols="40" rows="3" class="content-input" dataType="LimitB" min="1" max="1000" msg="关键字描述[1,1000]字符以内"></textarea></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">简单描述</td>
    <td bgcolor="#FFFFFF"><textarea name="Simple" cols="40" rows="3" class="content-input" id="Simple" datatype="LimitB" min="1" max="1000" msg="关键字描述[1,1000]字符以内"></textarea></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">详细描述</td>
    <td bgcolor="#FFFFFF"><textarea style="width:80%;height:300px;visibility:hidden;" name="content" dataType="LimitB" min="1" max="10000" msg="商品详情[1,10000]字符以内">&nbsp;</textarea></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#FFFFFF">
    <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tab">
      <tr>
        <td colspan="7">商品购买来源</td>
        </tr>
      <tr>
        <td align="center" bgcolor="#FFFFFF">默认</td>
        <td bgcolor="#FFFFFF">店铺</td>
        <td bgcolor="#FFFFFF">链接</td>
        <td bgcolor="#FFFFFF">价格（日元）</td>
        <td bgcolor="#FFFFFF">运费（日元）</td>
        <td bgcolor="#FFFFFF">限购数量</td>
        <td bgcolor="#FFFFFF">预计到货时间</td>
        </tr>
        
        
      <%for i=1 to 5%>  
      <tr>
        <td align="center" bgcolor="#FFFFFF"><input name="radio" type="radio" id="radio3" value="<%=i%>" /></td>
        <td bgcolor="#FFFFFF">
        <select name="sid<%=i%>" size="5">
        <option disabled>实体店</option>
                    <%		
					set rsnewx=server.CreateObject("adodb.recordset")
					sql="select sid,title from shop where typeid=0"
					rsnewx.open sql,conn,1,3
					if not rsnewx.eof then
					do while not rsnewx.eof 
					%>
					<option value="<%=rsnewx("sid")%>" <%if bid=rsnewx("sid") then response.write "selected"%>>　<%=rsnewx("title")%></option>
					<%
					rsnewx.movenext
					loop
					rsnewx.close
					set rsnewx=nothing
					end if		 
					%>
         <option disabled>购物网</option> 
                    <%		
					set rsnewx=server.CreateObject("adodb.recordset")
					sql="select sid,title from shop where typeid=1 "
					rsnewx.open sql,conn,1,3
					if not rsnewx.eof then
					do while not rsnewx.eof 
					%>
					<option value="<%=rsnewx("sid")%>" <%if bid=rsnewx("sid") then response.write "selected"%>>　<%=rsnewx("title")%></option>
					<%
					rsnewx.movenext
					loop
					rsnewx.close
					set rsnewx=nothing
					end if		 
					%>
        </select>
        </td>
        <td bgcolor="#FFFFFF"><textarea name="url<%=i%>" rows="3" class="content-input" id="url<%=i%>" datatype="LimitB" min="1" max="1000" msg="关键字描述[1,1000]字符以内"><%=desc%></textarea></td>
        <td bgcolor="#FFFFFF"><input name="price<%=i%>" type="text" class="input" id="price<%=i%>" style="width:40px" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="transCost<%=i%>" type="text" class="input" id="transCost<%=i%>" style="width:40px" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="Limited<%=i%>" type="text" class="input" id="Limited<%=i%>" style="width:40px" value="0" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        <td bgcolor="#FFFFFF"><input name="Arrivaltime<%=i%>" type="text" class="input" id="Arrivaltime<%=i%>" style="width:40px" value="0" datatype="Number" min="1" max="5" msg="排序必须为数字"/></td>
        </tr>
       <%next%> 
        
        
        
        
    </table>
    </td>
    </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><input type="submit" name="button" id="button" value="添加" /><input type="hidden" name="inquiryID" value="<%=inquiryID%>" />
      </td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
  </table>
  </div>
</div>
  </form>
  <%end if%>

</body>
</html>
<%
if request.Form("button")="来源添加" then
		for i=1 to 5
				if checkstr(inHTML(request.Form("sid"&i)))<>"" and checkstr(inHTML(request.Form("price"&i)))<>"" and checkstr(inHTML(request.Form("transCost"&i)))<>"" and checkstr(inHTML(request.Form("Limited"&i)))<>"" and checkstr(inHTML(request.Form("Arrivaltime"&i)))<>"" then
		  set rsx=server.createobject("adodb.recordset")
		  sql="select * from Source"
		  rsx.open sql,conn,1,3
		  rsx.addnew
		  rsx("sid")=checkstr(inHTML(request.Form("sid"&i)))
		  rsx("url")=checkstr(inHTML(request.Form("url"&i)))
		 ' rsx("itemid")=checkstr(inHTML(request.Form("itemid"&i)))
		  rsx("price")=checkstr(inHTML(request.Form("price"&i)))
		  rsx("transCost")=checkstr(inHTML(request.Form("transCost"&i)))
		  rsx("Limited")=checkstr(inHTML(request.Form("Limited"&i)))
		  rsx("Arrivaltime")=checkstr(inHTML(request.Form("Arrivaltime"&i)))
		  if radio=trim(i) then rsx("istop")=0
		  rsx("pid")=id
		  rsx.update
		  rsx.close
		  set rsx=nothing
		end if
	  next
	  response.write"<script language=JavaScript>{window.alert('来源添加成功！');window.location.href='add.asp?id="&id&"';}</script>"

elseif request.QueryString("did")<>"" then
       conn.execute("delete from Source where id="&request.QueryString("did")&"")
	   response.write"<script language=JavaScript>{window.alert('删除成功！');window.location.href='add.asp?id="&id&"';}</script>"


elseif request.Form("button")="添加" then

	  title=request.Form("title")
	  jptitle=request.Form("jptitle")
	  sort=request.Form("sort")
	  typeid=request.Form("typeid")
	  bid=request.Form("bid")
	  weight=request.Form("weight")
	  color=request.Form("color")
	  size=request.Form("size")
	  RelationID=request.Form("RelationID")
	  pic=request.Form("pic")
	  mark=request.Form("mark")
	  key=request.Form("key")
	  desc=request.Form("desc")
	  Simple=request.Form("Simple")
	  content=request.Form("content")
	  radio=request.Form("radio")
	  inventory=request.Form("inventory")
	  
	  inquiryID=request.Form("inquiryID")
	  
	  sid1=request.Form("sid1") '第一个来源类目
	  price1=request.Form("price1") '第一个来源价格
	  transCost1=request.Form("transCost1") '第一个来源运费
	  

      if sort="" then sort=0 
	  
	  if title="" or typeid="" or bid="" or radio="" or sid1="" or price1="" or transCost1="" then
	  response.write"<script>alert('中文标题、日文标题、类目、商品来源默认不能为空');</script>"
	  response.write"<script>window.history.back(-1);</script>"
	  response.end
	  end if

	  set rsx=server.createobject("adodb.recordset")
	  sql="select * from product"
	  rsx.open sql,conn,1,3
	  rsx.addnew
	  rsx("title")=title
	  rsx("jptitle")=jptitle
	  rsx("sort")=sort
	  rsx("type")=typeid
	  rsx("bid")=bid
	  rsx("weight")=weight
	  rsx("color")=color
	  rsx("size")=size
	  if RelationID<>"" then rsx("RelationID")=RelationID
	  rsx("pic")=pic
	  rsx("mark")=mark
	  rsx("key")=key
	  rsx("desc")=desc
	  rsx("Simple")=Simple
	  rsx("content")=content
	  rsx("inventory")=inventory
	  rsx("adminname")=request.cookies("admin")("name")
	  rsx.update
	  temp = rsx.bookmark 
	  rsx.bookmark = temp 
	  pid=rsx("pid") 
	  rsx.close
	  set rsx=nothing
	  
	  for i=1 to 5
		if checkstr(inHTML(request.Form("sid"&i)))<>"" and checkstr(inHTML(request.Form("price"&i)))<>"" and checkstr(inHTML(request.Form("transCost"&i)))<>"" and checkstr(inHTML(request.Form("Limited"&i)))<>"" and checkstr(inHTML(request.Form("Arrivaltime"&i)))<>"" then
		  set rsx=server.createobject("adodb.recordset")
		  sql="select * from Source"
		  rsx.open sql,conn,1,3
		  rsx.addnew
		  rsx("sid")=checkstr(inHTML(request.Form("sid"&i)))
		  rsx("url")=checkstr(inHTML(request.Form("url"&i)))
		  rsx("itemid")=checkstr(inHTML(request.Form("itemid"&i)))
		  rsx("price")=checkstr(inHTML(request.Form("price"&i)))
		  rsx("transCost")=checkstr(inHTML(request.Form("transCost"&i)))
		  rsx("Limited")=checkstr(inHTML(request.Form("Limited"&i)))
		  rsx("Arrivaltime")=checkstr(inHTML(request.Form("Arrivaltime"&i)))
		  if radio=trim(i) then rsx("istop")=1
		  rsx("pid")=pid
		  rsx.update
		  rsx.close
		  set rsx=nothing
		end if
	  next
	  
	  '更新
	  if inquiryID<>"" then
	    set rss=conn.execute("select * from Source where pid="&pid&" and istop=1")
		inquiryprice=rss("price")
		SourceID=rss("id")
		set rss=nothing
		conn.execute("update inquiry set falg=1,price='"&inquiryprice&"',SourceID="&SourceID&" where id="&inquiryID&"")
	  end if
	  
	  response.write"<script language=JavaScript>{window.alert('添加成功！');window.location.href='view.asp';}</script>"

elseif request.Form("button")="保存" then

	  title=request.Form("title")
	  jptitle=request.Form("jptitle")
	  sort=request.Form("sort")
	  typeid=request.Form("typeid")
	  bid=request.Form("bid")
	  weight=request.Form("weight")
	  color=request.Form("color")
	  size=request.Form("size")
	  RelationID=request.Form("RelationID")
	  pic=request.Form("pic")
	  mark=request.Form("mark")
	  key=request.Form("key")
	  desc=request.Form("desc")
	  Simple=request.Form("Simple")
	  content=request.Form("content")
	  Eid=request.Form("Eid")
	  radio=request.Form("radio")
	  inventory=request.Form("inventory")
	  
	  if sort="" then sort=0 

	  if title="" or typeid="" or bid="" or radio="" then
	  response.write"<script>alert('中文标题、类目、商品来源默认不能为空');</script>"
	  response.write"<script>window.history.back(-1);</script>"
	  response.end
	  end if

	  set rsx=server.createobject("adodb.recordset")
	  sql="select * from product where pid="&id&""
	  rsx.open sql,conn,1,3
	  rsx("title")=title
	  rsx("jptitle")=jptitle
	  rsx("sort")=sort
	  rsx("type")=typeid
	  rsx("bid")=bid
	  rsx("weight")=weight
	  rsx("color")=color
	  rsx("size")=size
	  if RelationID<>"" then rsx("RelationID")=RelationID
	  rsx("pic")=pic
	  rsx("mark")=mark
	  rsx("key")=key
	  rsx("desc")=desc
	  rsx("Simple")=Simple
	  rsx("content")=content
	  rsx("inventory")=inventory
	  rsx("adminname")=request.cookies("admin")("name")
	  rsx.update
	  rsx.close
	  set rsx=nothing
	  
	  Eid=split(replace(Eid," ",""),",")
	  for i=0 to ubound(Eid)
	      set rsx=server.createobject("adodb.recordset")
		  sql="select * from Source where id="&Eid(i)&""
		  rsx.open sql,conn,1,3
		  rsx("sid")=checkstr(inHTML(request.Form("sid"&Eid(i))))
		  rsx("url")=checkstr(inHTML(request.Form("url"&Eid(i))))
		  'rsx("itemid")=checkstr(inHTML(request.Form("itemid"&Eid(i))))
		  rsx("price")=checkstr(inHTML(request.Form("price"&Eid(i))))
		  rsx("transCost")=checkstr(inHTML(request.Form("transCost"&Eid(i))))
		  rsx("Limited")=checkstr(inHTML(request.Form("Limited"&Eid(i))))
		  rsx("Arrivaltime")=checkstr(inHTML(request.Form("Arrivaltime"&Eid(i))))
		  if trim(radio)=Eid(i) then rsx("istop")=1 else rsx("istop")=0
		  rsx.update
		  rsx.close
		  set rsx=nothing
	  next
	  response.write"<script language=JavaScript>{window.alert('保存成功！');window.location.href='add.asp?id="&id&"';}</script>"


elseif request.Form("button")="保存为新商品" then

	  title=request.Form("title")
	  jptitle=request.Form("jptitle")
	  sort=request.Form("sort")
	  typeid=request.Form("typeid")
	  bid=request.Form("bid")
	  weight=request.Form("weight")
	  color=request.Form("color")
	  size=request.Form("size")
	  RelationID=request.Form("RelationID")
	  pic=request.Form("pic")
	  mark=request.Form("mark")
	  key=request.Form("key")
	  desc=request.Form("desc")
	  Simple=request.Form("Simple")
	  content=request.Form("content")
	  Eid=request.Form("Eid")
	  radio=request.Form("radio")
	  inventory=request.Form("inventory")
	  
	  if sort="" then sort=0 

	  if title="" or typeid="" or bid="" or radio="" then
	  response.write"<script>alert('中文标题、类目、商品来源默认不能为空');</script>"
	  response.write"<script>window.history.back(-1);</script>"
	  response.end
	  end if

	  set rsx=server.createobject("adodb.recordset")
	  sql="select * from product"
	  rsx.open sql,conn,1,3
	  rsx.addnew
	  rsx("title")=title
	  rsx("jptitle")=jptitle
	  rsx("sort")=sort
	  rsx("type")=typeid
	  rsx("bid")=bid
	  rsx("weight")=weight
	  rsx("color")=color
	  rsx("size")=size
	  if RelationID<>"" then rsx("RelationID")=RelationID
	  rsx("pic")=pic
	  rsx("mark")=mark
	  rsx("key")=key
	  rsx("desc")=desc
	  rsx("Simple")=Simple
	  rsx("content")=content
	  rsx("inventory")=inventory
	  rsx("adminname")=request.cookies("admin")("name")
	  rsx.update
	  temp = rsx.bookmark 
	  rsx.bookmark = temp 
	  pid=rsx("pid") 
	  rsx.close
	  set rsx=nothing
	  
	  Eid=split(replace(Eid," ",""),",")
	  for i=0 to ubound(Eid)
	      set rsx=server.createobject("adodb.recordset")
		  sql="select * from Source where id="&Eid(i)&""
		  rsx.open sql,conn,1,3
		  rsx("sid")=checkstr(inHTML(request.Form("sid"&Eid(i))))
		  rsx("url")=checkstr(inHTML(request.Form("url"&Eid(i))))
		  'rsx("itemid")=checkstr(inHTML(request.Form("itemid"&Eid(i))))
		  rsx("price")=checkstr(inHTML(request.Form("price"&Eid(i))))
		  rsx("transCost")=checkstr(inHTML(request.Form("transCost"&Eid(i))))
		  rsx("Limited")=checkstr(inHTML(request.Form("Limited"&Eid(i))))
		  rsx("Arrivaltime")=checkstr(inHTML(request.Form("Arrivaltime"&Eid(i))))
		  if trim(radio)=Eid(i) then rsx("istop")=1 else rsx("istop")=0
		  rsx("pid")=pid
		  rsx.update
		  rsx.close
		  set rsx=nothing
	  next
	  response.write"<script language=JavaScript>{window.alert('保存成功！');window.location.href='view.asp';}</script>"
end if
%>